/*global define*/

define(['angular'], function (angular) {
    "use strict";

    var directive = function( $animate,$location ) {
        return({
            link: link,
            restrict: "C"
        });
        function link( scope, element, attributes ) {
            //console.log($location.path()!='/tab/index');
            if($location.path()!='/tab/index'){
                $animate.leave( element).then(
                    function cleanupAfterAnimation() {
                        element.remove();
                        scope = element = attributes = null;
                    }
                );
            }
        }
    }

    directive.$inject = ['$animate','$location'];
    return directive;
});

